﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="jquerymvc.Views.Home.Index" %>

<asp:Content ID="Content2" ContentPlaceHolderID="maincontent" runat="server">

    <h2>Welcome to my ASP.NET MVC Application!</h2>

    <form action="<%= Url.Action("Index") %>" method="post" id="submitform">
        Name: <input type="text" name="name" />
        <br /><br />
        <input type="submit" value="Say hello - normal" />
        <input type="submit" value="Say hello - unobtrusive ajax" 
            onclick="jQuery('#submitform').mvcAjaxForm('#dynamiccontent'); 
                        return false;" />
        <input type="button" value="Say hello -ajax" 
            onclick="jQuery('#submitform').mvcAjaxForm('#dynamiccontent')" />
        <input type="button" value="Say hello -json" 
            onclick="jQuery('#submitform').mvcJsonForm(function(obj) {
                jQuery('#dynamiccontent').html(obj.HelloWorld)})" />
    </form>
</asp:Content>

<asp:Content ContentPlaceHolderID="dynamiccontent" runat="server">
    <div id="HelloHolder" style="<%= String.IsNullOrEmpty(ViewData["HelloWorld"] as string) ? "display: none;" : String.Empty %>">
        <%= ViewData["HelloWorld"]%>
    </div>
</asp:Content>

